local minren = class('minren',function()
	return display.newNode()
end)

function minren:ctor()
	self:setScale(1.2)
	self:pos(display.cx,display.cy)
	display.newSolidCircle(8,{color = cc.c4f(1.0,0,1.0,0.8)}):addTo(self)
	local frames_jump = display.newFrames("min_jump_%03d.png", 0, 10)
	local frames_run = display.newFrames("min_run_%03d.png", 0, 6)
	local frames_die = display.newFrames("min_die_%03d.png", 0, 6)

	self.jump = cc.Sprite:create():addTo(self)
	self.run = cc.Sprite:create():addTo(self)
	self.die = cc.Sprite:create():addTo(self)

	self.jump:setPositionY(display.height/4)
	--self.run:setPositionY(display.height/3)
	self.die:setPositionY(-display.height/4)
	

	local sequence_die = cc.Sequence:create(
			cc.Animate:create(display.newAnimation(frames_die, 0.8/#frames_die)),
			cc.DelayTime:create(1.0)
		)
	self.jump:runAction(cc.RepeatForever:create(cc.Animate:create(display.newAnimation(frames_jump, 1.4/#frames_jump))))
	self.run:runAction(cc.RepeatForever:create(cc.Animate:create(display.newAnimation(frames_run, 0.8/#frames_run))))
	self.die:runAction(cc.RepeatForever:create(sequence_die))



	self.runBody = cc.PhysicsBody:createBox(cc.size(80,64),cc.PHYSICSBODY_MATERIAL_DEFAULT , cc.p(-44,60))
	self.run:setPhysicsBody(self.runBody)
end

return minren